home *** CD-ROM | disk | FTP | other *** search
/ Giga Games 1 / Giga Games.iso / net / usenet / volume11 / reve / patch3e < prev    next >
Encoding:
Internet Message Format  |  1991-01-03  |  47.0 KB

  1. Path: uunet!zephyr.ens.tek.com!tekred!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v12i005:  reve - an othello game, Patch3e
  5. Message-ID: <6763@tekred.CNA.TEK.COM>
  6. Date: 21 Dec 90 20:51:21 GMT
  7. Sender: news@tekred.CNA.TEK.COM
  8. Lines: 1468
  9. Approved: billr@saab.CNA.TEK.COM
  10.  
  11. Submitted-by: Rich Burridge <rburridge@sun.COM>
  12. Posting-number: Volume 12, Issue 5
  13. Archive-name: reve/Patch3e
  14. Patch-To: reve: Volume 11, Issue 52-58
  15. Environment: SunView, XView, X11R4, termcap
  16.  
  17.  
  18.  
  19. #! /bin/sh
  20. # This is a shell archive.  Remove anything before this line, then unpack
  21. # it by saving it into a file and typing "sh file".  To overwrite existing
  22. # files, type "sh file -c".  You can also feed this as standard input via
  23. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  24. # will see the following message at the end:
  25. #        "End of archive 5 (of 9)."
  26. # Contents:  patches03b
  27. # Wrapped by billr@saab on Fri Dec 21 11:27:09 1990
  28. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  29. if test -f 'patches03b' -a "${1}" != "-c" ; then 
  30.   echo shar: Will not clobber existing file \"'patches03b'\"
  31. else
  32. echo shar: Extracting \"'patches03b'\" \(44866 characters\)
  33. sed "s/^X//" >'patches03b' <<'END_OF_FILE'
  34. X
  35. X------- boardstuff.c -------
  36. X*** /tmp/da07561    Sun Dec  9 15:11:31 1990
  37. X--- boardstuff.c    Sat Dec  8 19:46:17 1990
  38. X***************
  39. X*** 27,37 ****
  40. X  #include "color.h"
  41. X  #include "extern.h"
  42. X  #include <ctype.h>
  43. X- #ifdef SYSV
  44. X- #include <sys/times.h>
  45. X- #else
  46. X- #include <sys/time.h>
  47. X- #endif /*SYSV*/
  48. X  
  49. X  #ifdef X11
  50. X  #include <X11/Xos.h>
  51. X--- 27,32 ----
  52. X***************
  53. X*** 182,188 ****
  54. X  
  55. X    taken = formfliplist(move, player) ;
  56. X    update_board_image(player) ;
  57. X!   SPRINTF(line, "%s took %d %s", (player == BLACK) ? "Black" : "White",
  58. X                            taken, (taken  == 1)     ? "stone" : "stones") ;
  59. X    message(PANEL_MES, line) ;
  60. X  }
  61. X--- 177,189 ----
  62. X  
  63. X    taken = formfliplist(move, player) ;
  64. X    update_board_image(player) ;
  65. X!   if (DO_LAST == FALSE && DO_NUMBER == FALSE)
  66. X!     SPRINTF(line, "%s moved at <%c-%c> and took %d %s",
  67. X!                   (player == BLACK) ? "Black" : "White",
  68. X!                   (move % 8)  + 'a', (move >> 3) + '1',
  69. X!                   taken, (taken  == 1)     ? "stone" : "stones") ;
  70. X!   else
  71. X!     SPRINTF(line, "%s took %d %s", (player == BLACK) ? "Black" : "White",
  72. X                            taken, (taken  == 1)     ? "stone" : "stones") ;
  73. X    message(PANEL_MES, line) ;
  74. X  }
  75. X***************
  76. X*** 205,214 ****
  77. X  {
  78. X    switch (piece)
  79. X      {
  80. X!       case BLACK : draw_stencil(x, y, PSIZE, PSIZE, op, C_BLACK,
  81. X                                  P_BLACK, P_BLACK) ;
  82. X                     break ;
  83. X!       case WHITE : draw_stencil(x, y, PSIZE, PSIZE, op, C_BLACK,
  84. X                                  P_BLACK, P_WHITE) ;
  85. X      }
  86. X  }
  87. X--- 206,215 ----
  88. X  {
  89. X    switch (piece)
  90. X      {
  91. X!       case BLACK : draw_stencil(W_MAIN, x, y, PSIZE, PSIZE, op, C_BLACK,
  92. X                                  P_BLACK, P_BLACK) ;
  93. X                     break ;
  94. X!       case WHITE : draw_stencil(W_MAIN, x, y, PSIZE, PSIZE, op, C_BLACK,
  95. X                                  P_BLACK, P_WHITE) ;
  96. X      }
  97. X  }
  98. X***************
  99. X*** 215,228 ****
  100. X     
  101. X   
  102. X  void
  103. X! draw_rect(x1, y1, x2, y2, op, color)
  104. X  int x1, y1, x2, y2, color ;
  105. X  enum optype op ;
  106. X  {
  107. X!   draw_line(x1, y1, x2, y1, op, color) ;
  108. X!   draw_line(x1, y1, x1, y2, op, color) ;
  109. X!   draw_line(x2, y1, x2, y2, op, color) ;
  110. X!   draw_line(x1, y2, x2, y2, op, color) ;
  111. X  }
  112. X  
  113. X  
  114. X--- 216,230 ----
  115. X     
  116. X   
  117. X  void
  118. X! draw_rect(wtype, x1, y1, x2, y2, op, color)
  119. X! enum win_type wtype ;
  120. X  int x1, y1, x2, y2, color ;
  121. X  enum optype op ;
  122. X  {
  123. X!   draw_line(wtype, x1, y1, x2, y1, op, color) ;
  124. X!   draw_line(wtype, x1, y1, x1, y2, op, color) ;
  125. X!   draw_line(wtype, x2, y1, x2, y2, op, color) ;
  126. X!   draw_line(wtype, x1, y2, x2, y2, op, color) ;
  127. X  }
  128. X  
  129. X  
  130. X***************
  131. X*** 238,245 ****
  132. X  
  133. X    x = (move & 7)  * CELL_SIZE + BBORDER ;
  134. X    y = (move >> 3) * CELL_SIZE + BBORDER ;
  135. X!   draw_rect(x + offset,             CY + y + offset,
  136. X!             x + CELL_SIZE - offset, CY + y + CELL_SIZE - offset, RSRC, color) ;
  137. X  }
  138. X  
  139. X  
  140. X--- 240,248 ----
  141. X  
  142. X    x = (move & 7)  * CELL_SIZE + BBORDER ;
  143. X    y = (move >> 3) * CELL_SIZE + BBORDER ;
  144. X!   draw_rect(W_MAIN, x + offset,             CY + y + offset,
  145. X!                     x + CELL_SIZE - offset, CY + y + CELL_SIZE - offset,
  146. X!                     RSRC, color) ;
  147. X  }
  148. X  
  149. X  
  150. X***************
  151. X*** 385,390 ****
  152. X--- 388,395 ----
  153. X    if (legal(move, next_player, &board) == FALSE) return(0) ;
  154. X    (void) formfliplist(move, next_player) ;
  155. X    batch(IS_ON) ;
  156. X+   if (DO_LAST) show_last(last_move, IS_OFF) ;
  157. X+   if (DO_NUMBER) show_number(last_move, 59 - board.moves_left, IS_OFF) ;
  158. X    FOR_BOARD(i)
  159. X      if (board.square[i] != old_board.square[i])
  160. X        {
  161. X***************
  162. X*** 391,396 ****
  163. X--- 396,404 ----
  164. X          get_xy(i, &x, &y) ;
  165. X          draw_piece(next_player, x, CY+y, RSRC) ;
  166. X        } 
  167. X+   if (DO_LAST) show_last(move, IS_ON) ;
  168. X+   if (DO_NUMBER) show_number(move, 60 - board.moves_left, IS_ON) ;
  169. X+   last_move = move ;
  170. X    batch(IS_OFF) ;
  171. X    return(1) ;
  172. X  }
  173. X***************
  174. X*** 465,473 ****
  175. X  int player, move ;
  176. X  long note ;
  177. X  {
  178. X!   SPRINTF(line, "%s: <%c-%c> eval : %ld",
  179. X            (player == BLACK) ? "Black" : "White",
  180. X!           (move & 7) + 'a', (move >> 3) + '1', note) ;
  181. X    message(EVAL_MES, line) ;
  182. X  }
  183. X  
  184. X--- 473,481 ----
  185. X  int player, move ;
  186. X  long note ;
  187. X  {
  188. X!   SPRINTF(line, "%s: <%c-%c> eval : %ld depth: %d",
  189. X            (player == BLACK) ? "Black" : "White",
  190. X!           (move & 7) + 'a', (move >> 3) + '1', note, profmax) ;
  191. X    message(EVAL_MES, line) ;
  192. X  }
  193. X  
  194. X***************
  195. X*** 519,525 ****
  196. X              if (iscolor[d])
  197. X                {
  198. X                  get_xy(i, &x, &y) ;
  199. X!                 draw_stencil(x, CY+y, PSIZE, PSIZE, RSRC, C_BLACK,
  200. X                               P_WHITE, P_WHITE) ;
  201. X                }
  202. X              else
  203. X--- 527,533 ----
  204. X              if (iscolor[d])
  205. X                {
  206. X                  get_xy(i, &x, &y) ;
  207. X!                 draw_stencil(W_MAIN, x, CY+y, PSIZE, PSIZE, RSRC, C_BLACK,
  208. X                               P_WHITE, P_WHITE) ;
  209. X                }
  210. X              else
  211. X***************
  212. X*** 526,533 ****
  213. X                {
  214. X                  x = BBORDER + ((i & 7)  + 1) * CELL_SIZE - CELL_SIZE / 2 ;
  215. X                  y = BBORDER + ((i >> 3) + 1) * CELL_SIZE - CELL_SIZE / 2 ;
  216. X!                 draw_line(x-5, CY+y,   x+5, CY+y,   RSRC, C_BLACK) ;
  217. X!                 draw_line(x,   CY+y+5, x,   CY+y-5, RSRC, C_BLACK) ;
  218. X                }
  219. X            }
  220. X      }
  221. X--- 534,541 ----
  222. X                {
  223. X                  x = BBORDER + ((i & 7)  + 1) * CELL_SIZE - CELL_SIZE / 2 ;
  224. X                  y = BBORDER + ((i >> 3) + 1) * CELL_SIZE - CELL_SIZE / 2 ;
  225. X!                 draw_line(W_MAIN, x-5, CY+y,   x+5, CY+y,   RSRC, C_BLACK) ;
  226. X!                 draw_line(W_MAIN, x,   CY+y+5, x,   CY+y-5, RSRC, C_BLACK) ;
  227. X                }
  228. X            }
  229. X      }
  230. X***************
  231. X*** 540,546 ****
  232. X              x = (i & 7)  * CELL_SIZE + BBORDER + 1 ;
  233. X              y = (i >> 3) * CELL_SIZE + BBORDER + 1 ;  
  234. X              color = (iscolor[d]) ? C_LBROWN : C_WHITE ;
  235. X!             color_area(x, CY + y, CELL_SIZE - 2, CELL_SIZE - 2, color) ;
  236. X            }
  237. X      }    
  238. X    batch(IS_OFF) ;
  239. X--- 548,554 ----
  240. X              x = (i & 7)  * CELL_SIZE + BBORDER + 1 ;
  241. X              y = (i >> 3) * CELL_SIZE + BBORDER + 1 ;  
  242. X              color = (iscolor[d]) ? C_LBROWN : C_WHITE ;
  243. X!             color_area(W_MAIN, x, CY + y, CELL_SIZE - 2, CELL_SIZE - 2, color) ;
  244. X            }
  245. X      }    
  246. X    batch(IS_OFF) ;
  247. X***************
  248. X*** 554,565 ****
  249. X  long note ;
  250. X  {
  251. X    batch(IS_ON) ;
  252. X!   if (move == -1 || do_bestmove == FALSE) return ;
  253. X    if (best_cmove != -1)
  254. X!     draw_square(best_cmove, IS_OFF, 2) ;
  255. X    best_cmove = move ;
  256. X    draw_square(best_cmove, IS_ON, 2) ;
  257. X!   if (show_notes) set_eval(next_player, move, note) ;
  258. X    batch(IS_OFF) ;
  259. X  }
  260. X  
  261. X--- 562,578 ----
  262. X  long note ;
  263. X  {
  264. X    batch(IS_ON) ;
  265. X!   if (move == -1 || DO_BESTMOVE == FALSE) return ;
  266. X    if (best_cmove != -1)
  267. X!     {
  268. X!       draw_square(best_cmove, IS_OFF, 2) ;
  269. X!       if (DO_NUMBER) show_number(best_cmove, cmove_depth, IS_OFF) ;
  270. X!     }
  271. X    best_cmove = move ;
  272. X+   cmove_depth = profmax ;
  273. X    draw_square(best_cmove, IS_ON, 2) ;
  274. X!   if (DO_NUMBER) show_number(best_cmove, cmove_depth, IS_ON) ;
  275. X!   if (SHOW_NOTES) set_eval(next_player, move, note) ;
  276. X    batch(IS_OFF) ;
  277. X  }
  278. X  
  279. X***************
  280. X*** 569,603 ****
  281. X  int move ;
  282. X  enum bltype state ;
  283. X  {
  284. X!   if (move == -1 || do_last == FALSE) return ;
  285. X!   draw_square(move, state, 2) ;
  286. X  }
  287. X  
  288. X  
  289. X  void
  290. X! show_number(move, state)
  291. X! int move ;
  292. X  enum bltype state ;
  293. X  {
  294. X    char num[3] ;
  295. X!   int color, strw, val, x, y ;
  296. X  
  297. X!   if (move == -1 || do_number == FALSE) return ;
  298. X!   if (board.square[move] == BLACK)
  299. X      color = (state == IS_ON) ? C_WHITE : C_BLACK ;
  300. X    else if (board.square[move] == WHITE)
  301. X      color = (state == IS_ON) ? C_BLACK : C_WHITE ;
  302. X    x = (move & 7)  * CELL_SIZE + BBORDER + PIECE_MARGIN ;
  303. X    y = (move >> 3) * CELL_SIZE + BBORDER + PIECE_MARGIN ;
  304. X  
  305. X-   val = 60 - board.moves_left ;
  306. X-   if (state == IS_OFF) val-- ;
  307. X    SPRINTF(num, "%2d", val) ;
  308. X    strw = get_strwidth(NFONT, num) ;
  309. X  
  310. X    x = x + ((2 * PIECE_RAD) - strw) / 2 ;
  311. X    y = y + CY + nfont_height + ((2 * PIECE_RAD) - nfont_height) / 2 ;
  312. X!   draw_text(x, y, NFONT, color, num) ;
  313. X  }
  314. X  
  315. X  
  316. X--- 582,621 ----
  317. X  int move ;
  318. X  enum bltype state ;
  319. X  {
  320. X!   if (move == -1) return ;
  321. X!   if (board.moves_left < 60) draw_square(move, state, 2) ;
  322. X  }
  323. X  
  324. X  
  325. X  void
  326. X! show_number(move, val, state)
  327. X! int move, val ;
  328. X  enum bltype state ;
  329. X  {
  330. X    char num[3] ;
  331. X!   int color, strw, x, y ;
  332. X  
  333. X!   if (move == -1) return ;
  334. X! 
  335. X!        if (board.square[move] == BLACK)
  336. X      color = (state == IS_ON) ? C_WHITE : C_BLACK ;
  337. X    else if (board.square[move] == WHITE)
  338. X      color = (state == IS_ON) ? C_BLACK : C_WHITE ;
  339. X+   else if (iscolor[(int) cur_dpyno])
  340. X+     color = (state == IS_ON) ? C_BLACK : C_LBROWN ;
  341. X+   else
  342. X+     color = (state == IS_ON) ? C_BLACK : C_WHITE ;
  343. X+ 
  344. X    x = (move & 7)  * CELL_SIZE + BBORDER + PIECE_MARGIN ;
  345. X    y = (move >> 3) * CELL_SIZE + BBORDER + PIECE_MARGIN ;
  346. X  
  347. X    SPRINTF(num, "%2d", val) ;
  348. X    strw = get_strwidth(NFONT, num) ;
  349. X  
  350. X    x = x + ((2 * PIECE_RAD) - strw) / 2 ;
  351. X+   if (val < 10) x -= 3 ;
  352. X    y = y + CY + nfont_height + ((2 * PIECE_RAD) - nfont_height) / 2 ;
  353. X!   draw_text(W_MAIN, x, y, NFONT, color, num) ;
  354. X  }
  355. X  
  356. X  
  357. X***************
  358. X*** 611,620 ****
  359. X        rop = RCLR ;
  360. X        color = (iscolor[(int) cur_dpyno]) ? C_LBROWN : C_WHITE ;
  361. X        if (iscolor[(int) cur_dpyno]) rop = RSRC ;
  362. X!       draw_line(suggest_x-5, CY+suggest_y-5,
  363. X!                 suggest_x+5, CY+suggest_y+5, rop, color) ;
  364. X!       draw_line(suggest_x-5, CY+suggest_y+5,
  365. X!                 suggest_x+5, CY+suggest_y-5, rop, color) ;
  366. X        suggestion = -1 ;
  367. X      }
  368. X  }
  369. X--- 629,638 ----
  370. X        rop = RCLR ;
  371. X        color = (iscolor[(int) cur_dpyno]) ? C_LBROWN : C_WHITE ;
  372. X        if (iscolor[(int) cur_dpyno]) rop = RSRC ;
  373. X!       draw_line(W_MAIN, suggest_x-5, CY+suggest_y-5,
  374. X!                         suggest_x+5, CY+suggest_y+5, rop, color) ;
  375. X!       draw_line(W_MAIN, suggest_x-5, CY+suggest_y+5,
  376. X!                         suggest_x+5, CY+suggest_y-5, rop, color) ;
  377. X        suggestion = -1 ;
  378. X      }
  379. X  }
  380. X***************
  381. X*** 626,635 ****
  382. X  {
  383. X    int flips, i, piece, total_flips, x, y ;
  384. X   
  385. X!   total_flips = (quickgame == TRUE) ? 2 : 4 ;
  386. X    show_all(IS_OFF) ;
  387. X!   show_last(last_move, IS_OFF) ;
  388. X!   show_number(last_move, IS_OFF) ;
  389. X    show_suggestion() ;
  390. X    for (flips = 0; flips < total_flips; flips++)
  391. X      {
  392. X--- 644,653 ----
  393. X  {
  394. X    int flips, i, piece, total_flips, x, y ;
  395. X   
  396. X!   total_flips = (QUICKGAME == TRUE) ? 2 : 4 ;
  397. X    show_all(IS_OFF) ;
  398. X!   if (DO_LAST) show_last(last_move, IS_OFF) ;
  399. X!   if (DO_NUMBER) show_number(last_move, 59 - board.moves_left, IS_OFF) ;
  400. X    show_suggestion() ;
  401. X    for (flips = 0; flips < total_flips; flips++)
  402. X      {
  403. X***************
  404. X*** 648,660 ****
  405. X        batch(IS_OFF) ;
  406. X        PAUSE ;
  407. X      }
  408. X!   show_last(move, IS_ON) ;
  409. X!   show_number(move, IS_ON) ;
  410. X    last_move = move ;
  411. X    set_score() ;
  412. X    set_turn(OPPONENT(player)) ;
  413. X    message(TURN_MES, line) ;
  414. X!   if (show_notes)
  415. X      if ((player == BLACK && items[(int) BLACK_PLAYS].value == COMPUTER) ||
  416. X          (player == WHITE && items[(int) WHITE_PLAYS].value == COMPUTER))
  417. X        set_eval(player, move, note) ;
  418. X--- 666,678 ----
  419. X        batch(IS_OFF) ;
  420. X        PAUSE ;
  421. X      }
  422. X!   if (DO_LAST) show_last(move, IS_ON) ;
  423. X!   if (DO_NUMBER) show_number(move, 60 - board.moves_left, IS_ON) ;
  424. X    last_move = move ;
  425. X    set_score() ;
  426. X    set_turn(OPPONENT(player)) ;
  427. X    message(TURN_MES, line) ;
  428. X!   if (SHOW_NOTES)
  429. X      if ((player == BLACK && items[(int) BLACK_PLAYS].value == COMPUTER) ||
  430. X          (player == WHITE && items[(int) WHITE_PLAYS].value == COMPUTER))
  431. X        set_eval(player, move, note) ;
  432. X
  433. X------- events.c -------
  434. X*** /tmp/da07564    Sun Dec  9 15:11:32 1990
  435. X--- events.c    Sun Dec  9 14:09:16 1990
  436. X***************
  437. X*** 36,41 ****
  438. X--- 36,42 ----
  439. X  
  440. X    n = (int) item ;
  441. X    if (items[n].x == -1) return ;
  442. X+   if (items[n].wtype != curwin) return ;
  443. X    if ((curx >  items[n].x) && (curx < (items[n].x + items[n].width)) &&
  444. X        (cury >  items[n].y) && (cury < (items[n].y + items[n].height)))
  445. X      {
  446. X***************
  447. X*** 42,92 ****
  448. X        down = nextc ;
  449. X        itemno = n ;
  450. X        but_inverted = itemno ;
  451. X!       draw_button((enum panel_type) itemno, C_LGREY, BUT_INVERT) ;
  452. X      }
  453. X  }
  454. X  
  455. X  
  456. X  void
  457. X  check_cycle_down(item)
  458. X  enum panel_type item ;
  459. X  {
  460. X!   int ix, n, reply ;
  461. X  
  462. X    n = (int) item ;
  463. X!   ix = items[n].x + (3 * BWIDTH) + (2 * BGAP) - CWIDTH ;
  464. X!        if ((curx > ix) && (curx < (ix + (items[n].width / 2))) &&
  465. X!            (cury > items[n].y) && (cury < (items[n].y + items[n].height)) &&
  466. X              nextc != RIGHT_DOWN)
  467. X      {
  468. X        direction = INCREMENT ;
  469. X        down = nextc ;
  470. X        itemno = n ;
  471. X!       draw_cycle((enum panel_type) n, C_LGREY, CY_LINVERT) ;
  472. X      }
  473. X!   else if ((curx > ix) && (curx < (ix + items[n].width)) &&
  474. X!            (cury > items[n].y) && (cury < (items[n].y + items[n].height)) &&
  475. X              nextc != RIGHT_DOWN)
  476. X      {
  477. X        direction = DECREMENT ;
  478. X        down = nextc ;
  479. X        itemno = n ;
  480. X!       draw_cycle((enum panel_type) n, C_LGREY, CY_RINVERT) ;
  481. X      }
  482. X-   else if ((curx > ix) && (curx < (ix + items[n].width)) &&
  483. X-            (cury > items[n].y) && (cury < (items[n].y + items[n].height)))
  484. X-     {
  485. X-       direction = NONE ;
  486. X-       down = RIGHT_DOWN ;
  487. X-       itemno = n ;
  488. X-       reply = do_menu((enum panel_type) itemno) ;
  489. X-       if (reply)
  490. X-         {                                                   
  491. X-           nextc = RIGHT_UP ;                                
  492. X-           handle_item(reply - 1) ;
  493. X-           draw_cycle((enum panel_type) itemno, C_LGREY, CY_NORMAL) ;
  494. X-         }
  495. X-     }
  496. X  }
  497. X  
  498. X  
  499. X--- 43,97 ----
  500. X        down = nextc ;
  501. X        itemno = n ;
  502. X        but_inverted = itemno ;
  503. X!       draw_button(W_MAIN, (enum panel_type) itemno, C_LGREY, BUT_INVERT) ;
  504. X      }
  505. X  }
  506. X  
  507. X  
  508. X  void
  509. X+ check_choice_down(item)
  510. X+ enum panel_type item ;
  511. X+ {
  512. X+   int n ;
  513. X+ 
  514. X+   n = (int) item ;
  515. X+   if (items[n].wtype != curwin) return ;
  516. X+   if ((curx >  items[n].x) && (curx < (items[n].x + items[n].width)) &&
  517. X+       (cury >  items[n].y) && (cury < (items[n].y + items[n].height)))
  518. X+     {
  519. X+       down = nextc ;
  520. X+       itemno = n ;
  521. X+     }
  522. X+ }
  523. X+ 
  524. X+ 
  525. X+ void
  526. X  check_cycle_down(item)
  527. X  enum panel_type item ;
  528. X  {
  529. X!   int ix, n ;
  530. X  
  531. X    n = (int) item ;
  532. X!   if (items[n].wtype != curwin) return ;
  533. X!   ix = items[n].x + 40 ;
  534. X!        if ((curx > ix) && (curx < (ix + (CWIDTH / 2))) &&
  535. X!            (cury > items[n].y) && (cury < (items[n].y + CHEIGHT)) &&
  536. X              nextc != RIGHT_DOWN)
  537. X      {
  538. X        direction = INCREMENT ;
  539. X        down = nextc ;
  540. X        itemno = n ;
  541. X!       draw_cycle(curwin, (enum panel_type) n, C_LGREY, CY_LINVERT) ;
  542. X      }
  543. X!   else if ((curx > ix) && (curx < (ix + CWIDTH)) &&
  544. X!            (cury > items[n].y) && (cury < (items[n].y + CHEIGHT)) &&
  545. X              nextc != RIGHT_DOWN)
  546. X      {
  547. X        direction = DECREMENT ;
  548. X        down = nextc ;
  549. X        itemno = n ;
  550. X!       draw_cycle(curwin, (enum panel_type) n, C_LGREY, CY_RINVERT) ;
  551. X      }
  552. X  }
  553. X  
  554. X  
  555. X***************
  556. X*** 100,108 ****
  557. X        {
  558. X          case P_BUTTON  : check_button_down((enum panel_type) n) ;
  559. X                           break ;
  560. X          case P_CYCLE   : check_cycle_down((enum panel_type) n) ;
  561. X                           break ;
  562. X!         case P_MESSAGE : /* do nothing. */ ;
  563. X        }
  564. X  }
  565. X  
  566. X--- 105,116 ----
  567. X        {
  568. X          case P_BUTTON  : check_button_down((enum panel_type) n) ;
  569. X                           break ;
  570. X+         case P_CHOICE  : check_choice_down((enum panel_type) n) ;
  571. X+                          break ;
  572. X          case P_CYCLE   : check_cycle_down((enum panel_type) n) ;
  573. X                           break ;
  574. X!         case P_MESSAGE : break ;      /* Do nothing. */
  575. X!         case P_TOGGLE  : check_toggle_down((enum panel_type) n) ;
  576. X        }
  577. X  }
  578. X  
  579. X***************
  580. X*** 110,115 ****
  581. X--- 118,126 ----
  582. X  void
  583. X  check_item_up()
  584. X  {
  585. X+   int color, d ;
  586. X+ 
  587. X+   d = (int) cur_dpyno ;
  588. X    if ((nextc == LEFT_UP   && down == LEFT_DOWN)   ||
  589. X        (nextc == MIDDLE_UP && down == MIDDLE_DOWN) ||
  590. X        (nextc == RIGHT_UP  && down == RIGHT_DOWN))
  591. X***************
  592. X*** 116,130 ****
  593. X      {
  594. X        if (items[itemno].type == P_BUTTON && but_inverted == -1) return ;
  595. X        handle_item(items[itemno].value) ;
  596. X!       if (items[itemno].type == P_BUTTON && items[itemno].x != -1)
  597. X!         draw_button((enum panel_type) itemno, C_LGREY, BUT_NORMAL) ;
  598. X!       else if (items[itemno].type == P_CYCLE)
  599. X!         draw_cycle((enum panel_type) itemno, C_LGREY, CY_NORMAL) ;
  600. X      } 
  601. X  }
  602. X  
  603. X  
  604. X  void
  605. X  do_action()
  606. X  {
  607. X    int cx, cy, thismove ;
  608. X--- 127,174 ----
  609. X      {
  610. X        if (items[itemno].type == P_BUTTON && but_inverted == -1) return ;
  611. X        handle_item(items[itemno].value) ;
  612. X! 
  613. X!       switch (items[itemno].type)
  614. X!         {
  615. X!           case P_BUTTON : if (items[itemno].x != -1)
  616. X!                             draw_button(items[itemno].wtype,
  617. X!                                         (enum panel_type) itemno,
  618. X!                                         C_LGREY, BUT_NORMAL) ;
  619. X!                           break ;
  620. X!           case P_CHOICE : color = (iscolor[d]) ? C_BEIGE : C_WHITE ;
  621. X!                           draw_choice(items[itemno].wtype,
  622. X!                                       (enum panel_type) itemno, color) ;
  623. X!                           break ;
  624. X!           case P_CYCLE  : draw_cycle(items[itemno].wtype,
  625. X!                                      (enum panel_type) itemno,
  626. X!                                      C_LGREY, CY_NORMAL) ;
  627. X!                           break ;
  628. X!           case P_TOGGLE : color = (iscolor[d]) ? C_BEIGE : C_WHITE ;
  629. X!                           draw_toggle(items[itemno].wtype,
  630. X!                                       (enum panel_type) itemno, color) ;
  631. X!         }
  632. X      } 
  633. X  }
  634. X  
  635. X  
  636. X  void
  637. X+ check_toggle_down(item)
  638. X+ enum panel_type item ;
  639. X+ {
  640. X+   int n ;
  641. X+ 
  642. X+   n = (int) item ;
  643. X+   if (items[n].wtype != curwin) return ;
  644. X+   if ((curx >  items[n].x) && (curx < (items[n].x + items[n].width)) &&
  645. X+       (cury >  items[n].y) && (cury < (items[n].y + items[n].height)))
  646. X+     {
  647. X+       down = nextc ;
  648. X+       itemno = n ;
  649. X+     }
  650. X+ }
  651. X+ 
  652. X+ 
  653. X+ void
  654. X  do_action()
  655. X  {
  656. X    int cx, cy, thismove ;
  657. X***************
  658. X*** 131,137 ****
  659. X  
  660. X    switch (nextc)
  661. X      {
  662. X!       case MOUSE_MOVING : if (animation == TRUE)
  663. X                              draw_piece(next_player, piece_x, piece_y, RINV) ;
  664. X                            piece_x = curx - PIECE_RAD ;
  665. X                            piece_y = cury - PIECE_RAD ;
  666. X--- 175,181 ----
  667. X  
  668. X    switch (nextc)
  669. X      {
  670. X!       case MOUSE_MOVING : if (ANIMATION == TRUE)
  671. X                              draw_piece(next_player, piece_x, piece_y, RINV) ;
  672. X                            piece_x = curx - PIECE_RAD ;
  673. X                            piece_y = cury - PIECE_RAD ;
  674. X***************
  675. X*** 149,155 ****
  676. X                                draw_outline(last_outline, IS_ON) ;
  677. X                              }
  678. X  
  679. X!                           if (animation == TRUE)
  680. X                              draw_piece(next_player, piece_x, piece_y, RINV) ;
  681. X                            break ;
  682. X                            
  683. X--- 193,199 ----
  684. X                                draw_outline(last_outline, IS_ON) ;
  685. X                              }
  686. X  
  687. X!                           if (ANIMATION == TRUE)
  688. X                              draw_piece(next_player, piece_x, piece_y, RINV) ;
  689. X                            break ;
  690. X                            
  691. X***************
  692. X*** 157,163 ****
  693. X        case EXIT_WINDOW  : set_cursor(CANVASCUR) ;
  694. X                            draw_outline(last_outline, IS_OFF) ;
  695. X                            last_outline = -1 ;
  696. X!                           if (animation == TRUE)
  697. X                              draw_piece(next_player, piece_x, piece_y, RINV) ;
  698. X                            cmode = (enum cantype) ((int) cmode - 1) ;
  699. X                            break ;
  700. X--- 201,207 ----
  701. X        case EXIT_WINDOW  : set_cursor(CANVASCUR) ;
  702. X                            draw_outline(last_outline, IS_OFF) ;
  703. X                            last_outline = -1 ;
  704. X!                           if (ANIMATION == TRUE)
  705. X                              draw_piece(next_player, piece_x, piece_y, RINV) ;
  706. X                            cmode = (enum cantype) ((int) cmode - 1) ;
  707. X                            break ;
  708. X***************
  709. X*** 178,189 ****
  710. X  enum panel_type item ;
  711. X  int ch ;
  712. X  {
  713. X!   int val ;
  714. X  
  715. X    if (!validkey)
  716. X      {
  717. X        validkey = cur_ch ;
  718. X!       message(PANEL_MES, items[(int) item].text) ;
  719. X      }
  720. X    else
  721. X      {
  722. X--- 222,236 ----
  723. X  enum panel_type item ;
  724. X  int ch ;
  725. X  {
  726. X!   int color, d, maxw, val ;
  727. X  
  728. X+   d = (int) cur_dpyno ;
  729. X+   color = (iscolor[d]) ? C_BEIGE : C_WHITE ;
  730. X    if (!validkey)
  731. X      {
  732. X        validkey = cur_ch ;
  733. X!       if (item == OPT_EVAL) message(PANEL_MES, "Notes?") ;
  734. X!       else message(PANEL_MES, items[(int) item].label) ;
  735. X      }
  736. X    else
  737. X      {
  738. X***************
  739. X*** 190,232 ****
  740. X        val = -1 ;
  741. X        switch (item)
  742. X          {
  743. X!           case BLACK_PLAYS :
  744. X!           case WHITE_PLAYS : if (item == BLACK_PLAYS) curx = 0 ;
  745. X!                              else curx = BBORDER + (3*(BWIDTH+BGAP)) ;
  746. X!                              switch (ch)
  747. X                                 {
  748. X!                                  case 'c' :
  749. X!                                  case 'C' : val = 1 ;
  750. X!                                             items[(int) item].value = val ;
  751. X!                                             set_cycle(item,
  752. X!                                                       player_values[val]) ;
  753. X                                              break ;
  754. X!                                  case 'h' :
  755. X!                                  case 'H' : val = 0 ;
  756. X!                                             items[(int) item].value = val ;
  757. X!                                             set_cycle(item,
  758. X!                                                       player_values[val]) ;
  759. X                                              break ;
  760. X                                   default  : return ;
  761. X                                 }
  762. X!           case DIFFICULTY     : if (ch >= '1' && ch <= '9') val = ch - '1' ;
  763. X!                                 items[(int) item].value = val ;
  764. X!                                 set_cycle(item, diff_values[val]) ;
  765. X!                                 break ;
  766. X!           case NOTES          : switch (ch)
  767. X                                 {
  768. X                                   case 'n' :
  769. X                                   case 'N' : val = 0 ;
  770. X-                                             items[(int) item].value = val ;
  771. X-                                             set_cycle(item, notes_values[val]) ;
  772. X                                              break ;
  773. X                                   case 'y' :
  774. X                                   case 'Y' : val = 1 ;
  775. X-                                             items[(int) item].value = val ;
  776. X-                                             set_cycle(item, notes_values[val]) ;
  777. X                                              break ;
  778. X                                   default  : return ;
  779. X                                 }
  780. X          }
  781. X        if (val != -1)
  782. X          {
  783. X--- 237,282 ----
  784. X        val = -1 ;
  785. X        switch (item)
  786. X          {
  787. X!           case COMP_CHOICE : switch (ch)
  788. X                                 {
  789. X!                                  case 'a' :                  /* All (both). */
  790. X!                                  case 'A' : val = CP_BOTH ;
  791. X                                              break ;
  792. X!                                  case 'b' :                  /* Black. */
  793. X!                                  case 'B' : val = CP_BLACK ;
  794. X                                              break ;
  795. X+                                  case 'n' :                  /* Neither. */
  796. X+                                  case 'N' : val = CP_NEITHER ;
  797. X+                                             break ;
  798. X+                                  case 'w' :                  /* White. */
  799. X+                                  case 'W' : val = CP_WHITE ;
  800. X+                                             break ;
  801. X                                   default  : return ;
  802. X                                 }
  803. X!                              maxw = items[(int) item].width /
  804. X!                                     items[(int) item].nopts ;
  805. X!                              curx = items[(int) item].x + (maxw * val) ;
  806. X!                              itemno = (int) item ;
  807. X!                              items[(int) item].value = val ;
  808. X!                              draw_choice(W_PROPS, item, color) ;
  809. X!                              break ;
  810. X!           case DIFF_CHOICE : if (ch >= '1' && ch <= '9') val = ch - '1' ;
  811. X!                              items[(int) item].value = val ;
  812. X!                              draw_choice(W_PROPS, item, color) ;
  813. X!                              break ;
  814. X!           case OPT_EVAL    : color = (iscolor[d]) ? C_BEIGE : C_WHITE ;
  815. X!                              switch (ch)
  816. X                                 {
  817. X                                   case 'n' :
  818. X                                   case 'N' : val = 0 ;
  819. X                                              break ;
  820. X                                   case 'y' :
  821. X                                   case 'Y' : val = 1 ;
  822. X                                              break ;
  823. X                                   default  : return ;
  824. X                                 }
  825. X+                              items[(int) item].value = val ;
  826. X+                              draw_toggle(W_PROPS, OPT_EVAL, color) ;
  827. X          }
  828. X        if (val != -1)
  829. X          {
  830. X***************
  831. X*** 274,280 ****
  832. X                                set_cursor(NOCURSOR) ;
  833. X                                piece_x = curx - PIECE_RAD ;
  834. X                                piece_y = cury - PIECE_RAD ;
  835. X!                               if (animation == TRUE)
  836. X                                  draw_piece(next_player,
  837. X                                             piece_x, piece_y, RINV) ;
  838. X                                cmode = (enum cantype) ((int) cmode + 1) ;
  839. X--- 324,330 ----
  840. X                                set_cursor(NOCURSOR) ;
  841. X                                piece_x = curx - PIECE_RAD ;
  842. X                                piece_y = cury - PIECE_RAD ;
  843. X!                               if (ANIMATION == TRUE)
  844. X                                  draw_piece(next_player,
  845. X                                             piece_x, piece_y, RINV) ;
  846. X                                cmode = (enum cantype) ((int) cmode + 1) ;
  847. X***************
  848. X*** 292,305 ****
  849. X    process_event() ;
  850. X  
  851. X         if (nextc == FRAME_REPAINT) init_canvas() ;
  852. X    else if (nextc == KEYBOARD)      handle_key() ;
  853. X    else if (nextc == EXIT_WINDOW && but_inverted != -1)
  854. X      {
  855. X!       draw_button((enum panel_type) but_inverted, C_LGREY, BUT_NORMAL) ;
  856. X        but_inverted = -1 ;
  857. X        down = 0 ;
  858. X      }
  859. X!   else if (cury > (CY + BBORDER)) handle_board_event() ;
  860. X    else if (nextc == LEFT_UP || nextc == MIDDLE_UP || nextc == RIGHT_UP)
  861. X      check_item_up() ;
  862. X    else if (nextc == LEFT_DOWN || nextc == MIDDLE_DOWN || nextc == RIGHT_DOWN)
  863. X--- 342,356 ----
  864. X    process_event() ;
  865. X  
  866. X         if (nextc == FRAME_REPAINT) init_canvas() ;
  867. X+   else if (nextc == PROPS_REPAINT) paint_prop_sheet() ;
  868. X    else if (nextc == KEYBOARD)      handle_key() ;
  869. X    else if (nextc == EXIT_WINDOW && but_inverted != -1)
  870. X      {
  871. X!       draw_button(W_MAIN, (enum panel_type) but_inverted, C_LGREY, BUT_NORMAL) ;
  872. X        but_inverted = -1 ;
  873. X        down = 0 ;
  874. X      }
  875. X!   else if (curwin == W_MAIN && cury > (CY + BBORDER)) handle_board_event() ;
  876. X    else if (nextc == LEFT_UP || nextc == MIDDLE_UP || nextc == RIGHT_UP)
  877. X      check_item_up() ;
  878. X    else if (nextc == LEFT_DOWN || nextc == MIDDLE_DOWN || nextc == RIGHT_DOWN)
  879. X***************
  880. X*** 337,350 ****
  881. X      }
  882. X    switch (cur_ch)
  883. X      {
  884. X!       case 'B' : do_cycle_key(BLACK_PLAYS, nextc) ;    /* Cycle items. */
  885. X                   break ;
  886. X!       case 'D' : do_cycle_key(DIFFICULTY,  nextc) ;
  887. X                   break ;
  888. X!       case 'N' : do_cycle_key(NOTES,       nextc) ;
  889. X                   break ;
  890. X-       case 'W' : do_cycle_key(WHITE_PLAYS, nextc) ;
  891. X-                  break ;
  892. X  
  893. X        case 'M' : show_all_moves() ;                    /* Button items. */
  894. X                   break ;
  895. X--- 388,399 ----
  896. X      }
  897. X    switch (cur_ch)
  898. X      {
  899. X!       case 'C' : do_cycle_key(COMP_CHOICE, nextc) ;    /* Cycle items. */
  900. X                   break ;
  901. X!       case 'D' : do_cycle_key(DIFF_CHOICE, nextc) ;
  902. X                   break ;
  903. X!       case 'N' : do_cycle_key(OPT_EVAL,    nextc) ;
  904. X                   break ;
  905. X  
  906. X        case 'M' : show_all_moves() ;                    /* Button items. */
  907. X                   break ;
  908. X***************
  909. X*** 359,364 ****
  910. X--- 408,415 ----
  911. X        case 's' : suggest() ;
  912. X                   break ;
  913. X        case 'u' : undo() ;
  914. X+                  break ;
  915. X+       case 'p' : do_props() ;
  916. X                   break ;
  917. X  
  918. X        case 'q' : destroy_frame() ;
  919. X
  920. X------- items.c -------
  921. X*** /tmp/da07567    Sun Dec  9 15:11:33 1990
  922. X--- items.c    Sun Dec  9 13:53:06 1990
  923. X***************
  924. X*** 27,41 ****
  925. X  #include "color.h"
  926. X  #include "extern.h"
  927. X  
  928. X- #ifdef SYSV
  929. X- #include "string.h"
  930. X- #else
  931. X- #include <strings.h>
  932. X- #endif /*SYSV*/ 
  933. X  
  934. X- 
  935. X  void
  936. X! draw_button(item, color, image)      /* Draw a panel button. */
  937. X  enum panel_type item ;
  938. X  int color ;
  939. X  enum image_type image ;
  940. X--- 27,36 ----
  941. X  #include "color.h"
  942. X  #include "extern.h"
  943. X  
  944. X  
  945. X  void
  946. X! draw_button(wtype, item, color, image)      /* Draw a panel button. */
  947. X! enum win_type wtype ;
  948. X  enum panel_type item ;
  949. X  int color ;
  950. X  enum image_type image ;
  951. X***************
  952. X*** 47,102 ****
  953. X    y = items[(int) item].y ;
  954. X    if (iscolor[(int) cur_dpyno])
  955. X      {
  956. X!       draw_stencil(x, y, BWIDTH, BHEIGHT, RSRC, color,
  957. X                     BUT_STENCIL, BUT_STENCIL) ;
  958. X!       draw_image(x, y, BWIDTH, BHEIGHT, image) ;
  959. X      }
  960. X!   else draw_stencil(x, y, BWIDTH, BHEIGHT, RSRC, C_WHITE, BUT_STENCIL, image) ;
  961. X    label = items[(int) item].text ;
  962. X    if (image == BUT_INVERT) color = C_WHITE ;
  963. X    else                     color = C_BLACK ;
  964. X    x += ((BWIDTH - get_strwidth(NFONT, label)) / 2) ;
  965. X    y += (nfont_height + (BHEIGHT - nfont_height) / 2) - 5 ;
  966. X!   draw_text(x, y, NFONT, color, label) ;
  967. X  }
  968. X  
  969. X  
  970. X  void
  971. X! draw_cycle(item, color, image)
  972. X  enum panel_type item ;
  973. X  int color ;
  974. X  enum image_type image ;
  975. X  {
  976. X    int x, y ;
  977. X  
  978. X!   x = items[(int) item].x + (3 * BWIDTH) + (2 * BGAP) - CWIDTH ;
  979. X    y = items[(int) item].y ;
  980. X    if (iscolor[(int) cur_dpyno])
  981. X      {
  982. X!       draw_stencil(x, y, CWIDTH, CHEIGHT, RSRC, color, CY_STENCIL, CY_STENCIL) ;
  983. X!       draw_image(x, y, CWIDTH, CHEIGHT, image) ;
  984. X      }
  985. X!   else draw_stencil(x, y, CWIDTH, CHEIGHT, RSRC, C_WHITE, CY_STENCIL, image) ;
  986. X  }
  987. X  
  988. X  
  989. X  void
  990. X! draw_cycle_item(item, choices, color, image)  /* Display cycle panel item. */
  991. X  enum panel_type item ;
  992. X- char *choices[] ;
  993. X  int color ;
  994. X  enum image_type image ;
  995. X  {
  996. X!   char *label ;
  997. X!   int n, x, y ;
  998. X  
  999. X!   n = (int) item ;
  1000. X!   label = items[n].text ;
  1001. X!   x = items[n].x ;
  1002. X!   y = items[n].y ;
  1003. X!   draw_text(x, y + bfont_height, BFONT, C_BLACK, label) ;
  1004. X!   set_cycle(item, choices[items[n].value]) ;
  1005. X!   draw_cycle(item, color, image) ;
  1006. X  }
  1007. X  
  1008. X  
  1009. X--- 42,154 ----
  1010. X    y = items[(int) item].y ;
  1011. X    if (iscolor[(int) cur_dpyno])
  1012. X      {
  1013. X!       draw_stencil(wtype, x, y, BWIDTH, BHEIGHT, RSRC, color,
  1014. X                     BUT_STENCIL, BUT_STENCIL) ;
  1015. X!       draw_image(wtype, x, y, BWIDTH, BHEIGHT, image) ;
  1016. X      }
  1017. X!   else draw_stencil(wtype, x, y, BWIDTH, BHEIGHT, RSRC, C_WHITE,
  1018. X!                     BUT_STENCIL, image) ;
  1019. X    label = items[(int) item].text ;
  1020. X    if (image == BUT_INVERT) color = C_WHITE ;
  1021. X    else                     color = C_BLACK ;
  1022. X    x += ((BWIDTH - get_strwidth(NFONT, label)) / 2) ;
  1023. X    y += (nfont_height + (BHEIGHT - nfont_height) / 2) - 5 ;
  1024. X!   draw_text(wtype, x, y, NFONT, color, label) ;
  1025. X  }
  1026. X  
  1027. X  
  1028. X  void
  1029. X! draw_choice(wtype, item, color)
  1030. X! enum win_type wtype ;
  1031. X  enum panel_type item ;
  1032. X  int color ;
  1033. X+ {
  1034. X+   char *str ;
  1035. X+   int height, i, maxw, val, width, x, xoff, y ;
  1036. X+ 
  1037. X+   if (strlen(items[(int) item].label))
  1038. X+     draw_text(items[(int) item].wtype,
  1039. X+               items[(int) item].lx, items[(int) item].ly + bfont_height,
  1040. X+               BFONT, C_BLACK, items[(int) item].label) ;
  1041. X+ 
  1042. X+   maxw = 0 ;
  1043. X+   for (i = 0; i < items[(int) item].nopts; i++)
  1044. X+     {
  1045. X+       str = items[(int) item].options[i] ;
  1046. X+       if ((val = get_strwidth(NFONT, str)) > maxw) maxw = val ;
  1047. X+     }
  1048. X+ 
  1049. X+   maxw += CHOICEGAP ;
  1050. X+   x = items[(int) item].x ;
  1051. X+   y = items[(int) item].y ;
  1052. X+   height = nfont_height * 2 ;
  1053. X+   width = items[(int) item].nopts * maxw ;
  1054. X+   color_area(wtype, x, y, width, height, color) ;
  1055. X+   draw_rect(wtype, x, y, x + width, y + height, RSRC, C_BLACK) ;
  1056. X+ 
  1057. X+   items[(int) item].width = width ;
  1058. X+   items[(int) item].height = height ;
  1059. X+ 
  1060. X+   for (i = 1; i < items[(int) item].nopts; i++)
  1061. X+     draw_line(W_PROPS, x + (i * maxw), y,
  1062. X+                        x + (i * maxw), y + height, RSRC, C_BLACK) ;
  1063. X+ 
  1064. X+   for (i = 0; i < items[(int) item].nopts; i++)
  1065. X+     {
  1066. X+       str = items[(int) item].options[i] ;
  1067. X+       val = get_strwidth(NFONT, str) ;
  1068. X+       xoff = (maxw - val) / 2 ;
  1069. X+       draw_text(items[(int) item].wtype,
  1070. X+                 x + (i * maxw) + xoff,
  1071. X+                 y + nfont_height + (nfont_height / 2), NFONT, C_BLACK, str) ;
  1072. X+     }
  1073. X+ 
  1074. X+   val = items[(int) item].value ;
  1075. X+   draw_rect(wtype,
  1076. X+             x + (val * maxw) + 1, y + 1,
  1077. X+             x + ((val + 1) * maxw) - 1, y + height - 1, RSRC, C_BLACK) ;
  1078. X+ }
  1079. X+ 
  1080. X+ 
  1081. X+ void
  1082. X+ draw_cycle(wtype, item, color, image)
  1083. X+ enum win_type wtype ;
  1084. X+ enum panel_type item ;
  1085. X+ int color ;
  1086. X  enum image_type image ;
  1087. X  {
  1088. X    int x, y ;
  1089. X  
  1090. X!   x = items[(int) item].x + 40 ;
  1091. X    y = items[(int) item].y ;
  1092. X    if (iscolor[(int) cur_dpyno])
  1093. X      {
  1094. X!       draw_stencil(wtype, x, y, CWIDTH, CHEIGHT, RSRC, color,
  1095. X!                    CY_STENCIL, CY_STENCIL) ;
  1096. X!       draw_image(wtype, x, y, CWIDTH, CHEIGHT, image) ;
  1097. X      }
  1098. X!   else draw_stencil(wtype, x, y, CWIDTH, CHEIGHT, RSRC, C_WHITE,
  1099. X!                     CY_STENCIL, image) ;
  1100. X  }
  1101. X  
  1102. X  
  1103. X  void
  1104. X! draw_cycle_item(wtype, item, color, image)
  1105. X! enum win_type wtype ;
  1106. X  enum panel_type item ;
  1107. X  int color ;
  1108. X  enum image_type image ;
  1109. X  {
  1110. X!   char val[4] ;
  1111. X  
  1112. X!   if (strlen(items[(int) item].label))
  1113. X!     draw_text(items[(int) item].wtype,
  1114. X!               items[(int) item].lx, items[(int) item].ly + bfont_height,
  1115. X!               BFONT, C_BLACK, items[(int) item].label) ;
  1116. X! 
  1117. X!   SPRINTF(val, "%d", items[(int) item].value) ;
  1118. X!   set_cycle(wtype, item, val) ;
  1119. X!   draw_cycle(wtype, item, color, image) ;
  1120. X  }
  1121. X  
  1122. X  
  1123. X***************
  1124. X*** 106,121 ****
  1125. X  {
  1126. X    int y ;
  1127. X  
  1128. X!   color_area(tx + 1, ty + 1, tw - 2, th - 2, C_WHITE) ;
  1129. X    y = ty + (nfont_height + (th - nfont_height) / 2) - 5 ;
  1130. X!   draw_text(tx + 5, y, NFONT, C_BLACK, str) ;
  1131. X!   draw_line(tx + 5 + get_strwidth(NFONT, str), y + 5,
  1132. X!             tx + 5 + get_strwidth(NFONT, str), y + 5 - nfont_height,
  1133. X!             RSRC, C_BLACK) ;
  1134. X  }
  1135. X  
  1136. X  
  1137. X  void
  1138. X  draw_textfield()
  1139. X  {
  1140. X    int x1, y1 ;
  1141. X--- 158,209 ----
  1142. X  {
  1143. X    int y ;
  1144. X  
  1145. X!   color_area(W_MAIN, tx + 1, ty + 1, tw - 2, th - 2, C_WHITE) ;
  1146. X    y = ty + (nfont_height + (th - nfont_height) / 2) - 5 ;
  1147. X!   draw_text(W_MAIN, tx + 5, y, NFONT, C_BLACK, str) ;
  1148. X!   draw_line(W_MAIN, tx + 5 + get_strwidth(NFONT, str), y + 5,
  1149. X!                     tx + 5 + get_strwidth(NFONT, str), y + 5 - nfont_height,
  1150. X!                     RSRC, C_BLACK) ;
  1151. X  }
  1152. X  
  1153. X  
  1154. X  void
  1155. X+ draw_toggle(wtype, item, color)
  1156. X+ enum win_type wtype ;
  1157. X+ enum panel_type item ;
  1158. X+ int color ;
  1159. X+ {
  1160. X+   enum image_type image ;
  1161. X+   int x, y ;
  1162. X+ 
  1163. X+   if (strlen(items[(int) item].label))
  1164. X+     draw_text(items[(int) item].wtype,
  1165. X+               items[(int) item].lx, items[(int) item].ly + bfont_height,
  1166. X+               BFONT, C_BLACK, items[(int) item].label) ;
  1167. X+ 
  1168. X+   if (items[(int) item].value) image = TOGGLE_ON ;
  1169. X+   else                         image = TOGGLE_OFF ;
  1170. X+ 
  1171. X+   x = items[(int) item].x ;
  1172. X+   y = items[(int) item].y ;
  1173. X+   if (iscolor[(int) cur_dpyno])
  1174. X+     {
  1175. X+       draw_stencil(wtype, x, y, TICKWIDTH, TICKHEIGHT, RSRC, color,
  1176. X+                    CY_STENCIL, CY_STENCIL) ;
  1177. X+       draw_image(wtype, x, y, TICKWIDTH, TICKHEIGHT, image) ;
  1178. X+     }
  1179. X+   else draw_stencil(wtype, x, y, TICKWIDTH, TICKHEIGHT, RSRC, C_WHITE,
  1180. X+                     CY_STENCIL, image) ;
  1181. X+ 
  1182. X+   if (strlen(items[(int) item].text))
  1183. X+     draw_text(items[(int) item].wtype,
  1184. X+               items[(int) item].x + TICKWIDTH + 10,
  1185. X+               items[(int) item].y + nfont_height,
  1186. X+               NFONT, C_BLACK, items[(int) item].text) ;
  1187. X+ }
  1188. X+ 
  1189. X+ 
  1190. X+ void
  1191. X  draw_textfield()
  1192. X  {
  1193. X    int x1, y1 ;
  1194. X***************
  1195. X*** 123,132 ****
  1196. X    lsval = (curx < (BBORDER + (2*(BWIDTH+BGAP)))) ? 'l' : 's' ;
  1197. X    x1 = BBORDER + BWIDTH + (BGAP / 2) ;
  1198. X    y1 = BBORDER + BHEIGHT + (BGAP / 2) ;
  1199. X!   color_area(x1, y1, 4 * (BWIDTH + BGAP), BHEIGHT + BGAP, C_WHITE) ;
  1200. X!   draw_rect(x1, y1, x1 + (4 * (BWIDTH + BGAP)) - 1,
  1201. X!                 y1 + BHEIGHT + BGAP - 1, RSRC, C_BLACK) ;
  1202. X!   draw_text(BBORDER + BWIDTH + BGAP, BBORDER + BHEIGHT + BGAP +
  1203. X              (nfont_height + (BHEIGHT - nfont_height) / 2) - 5,
  1204. X              BFONT, C_BLACK, "File:") ;
  1205. X    tx = BBORDER + BWIDTH + BGAP + (BWIDTH / 2) + 10 ;
  1206. X--- 211,220 ----
  1207. X    lsval = (curx < (BBORDER + (2*(BWIDTH+BGAP)))) ? 'l' : 's' ;
  1208. X    x1 = BBORDER + BWIDTH + (BGAP / 2) ;
  1209. X    y1 = BBORDER + BHEIGHT + (BGAP / 2) ;
  1210. X!   color_area(W_MAIN, x1, y1, 4 * (BWIDTH + BGAP), BHEIGHT + BGAP, C_WHITE) ;
  1211. X!   draw_rect(W_MAIN, x1, y1, x1 + (4 * (BWIDTH + BGAP)) - 1,
  1212. X!                     y1 + BHEIGHT + BGAP - 1, RSRC, C_BLACK) ;
  1213. X!   draw_text(W_MAIN, BBORDER + BWIDTH + BGAP, BBORDER + BHEIGHT + BGAP +
  1214. X              (nfont_height + (BHEIGHT - nfont_height) / 2) - 5,
  1215. X              BFONT, C_BLACK, "File:") ;
  1216. X    tx = BBORDER + BWIDTH + BGAP + (BWIDTH / 2) + 10 ;
  1217. X***************
  1218. X*** 133,145 ****
  1219. X    ty = BBORDER + BHEIGHT + BGAP ;
  1220. X    tw = (BWIDTH / 2) - 10 + (2 * (BWIDTH + BGAP)) ;
  1221. X    th = BHEIGHT ;
  1222. X!   draw_rect(tx, ty, tx + tw, ty + th, RSRC, C_BLACK) ;
  1223. X    draw_filename(gamefile) ;
  1224. X  
  1225. X    tinput = 1 ;
  1226. X    items[(int) CANCEL_BUT].x = BBORDER + (4*(BWIDTH+BGAP)) ;
  1227. X    items[(int) CANCEL_BUT].y = BBORDER + (1*(BHEIGHT+BGAP)) ;
  1228. X!   draw_button(CANCEL_BUT, C_LGREY, BUT_NORMAL) ;
  1229. X  }
  1230. X  
  1231. X  
  1232. X--- 221,233 ----
  1233. X    ty = BBORDER + BHEIGHT + BGAP ;
  1234. X    tw = (BWIDTH / 2) - 10 + (2 * (BWIDTH + BGAP)) ;
  1235. X    th = BHEIGHT ;
  1236. X!   draw_rect(W_MAIN, tx, ty, tx + tw, ty + th, RSRC, C_BLACK) ;
  1237. X    draw_filename(gamefile) ;
  1238. X  
  1239. X    tinput = 1 ;
  1240. X    items[(int) CANCEL_BUT].x = BBORDER + (4*(BWIDTH+BGAP)) ;
  1241. X    items[(int) CANCEL_BUT].y = BBORDER + (1*(BHEIGHT+BGAP)) ;
  1242. X!   draw_button(W_MAIN, CANCEL_BUT, C_LGREY, BUT_NORMAL) ;
  1243. X  }
  1244. X  
  1245. X  
  1246. X***************
  1247. X*** 175,192 ****
  1248. X  
  1249. X  
  1250. X  void
  1251. X! make_message(item)         /* Display a message panel. */
  1252. X  enum panel_type item ;
  1253. X  {
  1254. X    char *message ;
  1255. X    int x, y ;
  1256. X  
  1257. X    message = items[(int) item].text ;
  1258. X    x = items[(int) item].x ;
  1259. X    y = items[(int) item].y ;
  1260. X    color = (iscolor[(int) cur_dpyno]) ? C_BEIGE : C_WHITE ;
  1261. X!   color_area(x, y, TOTAL_WIDTH, 15, color) ;
  1262. X!   draw_text(x, y+nfont_height, NFONT, C_BLACK, message) ;
  1263. X  }
  1264. X  
  1265. X  
  1266. X--- 263,286 ----
  1267. X  
  1268. X  
  1269. X  void
  1270. X! make_message(wtype, item)         /* Display a message panel. */
  1271. X! enum win_type wtype ;
  1272. X  enum panel_type item ;
  1273. X  {
  1274. X    char *message ;
  1275. X    int x, y ;
  1276. X  
  1277. X+   if (strlen(items[(int) item].label))
  1278. X+     draw_text(items[(int) item].wtype,
  1279. X+               items[(int) item].lx, items[(int) item].ly + bfont_height,
  1280. X+               BFONT, C_BLACK, items[(int) item].label) ;
  1281. X+ 
  1282. X    message = items[(int) item].text ;
  1283. X    x = items[(int) item].x ;
  1284. X    y = items[(int) item].y ;
  1285. X    color = (iscolor[(int) cur_dpyno]) ? C_BEIGE : C_WHITE ;
  1286. X!   color_area(wtype, x, y, TOTAL_WIDTH, 15, color) ;
  1287. X!   draw_text(wtype, x, y + nfont_height, NFONT, C_BLACK, message) ;
  1288. X  }
  1289. X  
  1290. X  
  1291. X***************
  1292. X*** 193,217 ****
  1293. X  void
  1294. X  make_panel()
  1295. X  {
  1296. X!   draw_button(LOAD_BUT,     C_LGREY, BUT_NORMAL) ;
  1297. X!   draw_button(NEW_GAME_BUT, C_LGREY, BUT_NORMAL) ;
  1298. X!   draw_button(SAVE_BUT,     C_LGREY, BUT_NORMAL) ;
  1299. X!   draw_button(SHOW_ALL_BUT, C_LGREY, BUT_NORMAL) ;
  1300. X!   draw_button(SUGGEST_BUT,  C_LGREY, BUT_NORMAL) ;
  1301. X!   draw_button(UNDO_BUT,     C_LGREY, BUT_NORMAL) ;
  1302. X  
  1303. X!   draw_button(DONE_BUT,     C_LGREY, BUT_NORMAL) ;
  1304. X!   draw_button(QUIT_BUT,     C_LGREY, BUT_NORMAL) ;
  1305. X  
  1306. X!   draw_cycle_item(BLACK_PLAYS, player_values, C_LGREY, CY_NORMAL) ;
  1307. X!   draw_cycle_item(WHITE_PLAYS, player_values, C_LGREY, CY_NORMAL) ;
  1308. X!   draw_cycle_item(DIFFICULTY,  diff_values,   C_LGREY, CY_NORMAL) ;
  1309. X!   draw_cycle_item(NOTES,       notes_values,  C_LGREY, CY_NORMAL) ;
  1310. X! 
  1311. X!   make_message(PANEL_MES) ;
  1312. X!   make_message(EVAL_MES) ;
  1313. X!   make_message(SCORE_MES) ;
  1314. X!   make_message(TURN_MES) ;
  1315. X  }
  1316. X  
  1317. X  
  1318. X--- 287,308 ----
  1319. X  void
  1320. X  make_panel()
  1321. X  {
  1322. X!   draw_button(W_MAIN, LOAD_BUT,     C_LGREY, BUT_NORMAL) ;
  1323. X!   draw_button(W_MAIN, MOVES_BUT,    C_LGREY, BUT_NORMAL) ;
  1324. X!   draw_button(W_MAIN, NEW_GAME_BUT, C_LGREY, BUT_NORMAL) ;
  1325. X!   draw_button(W_MAIN, SAVE_BUT,     C_LGREY, BUT_NORMAL) ;
  1326. X!   draw_button(W_MAIN, SUGGEST_BUT,  C_LGREY, BUT_NORMAL) ;
  1327. X!   draw_button(W_MAIN, UNDO_BUT,     C_LGREY, BUT_NORMAL) ;
  1328. X  
  1329. X!   draw_button(W_MAIN, PROPS_BUT,    C_LGREY, BUT_NORMAL) ;
  1330. X!   draw_button(W_MAIN, QUIT_BUT,     C_LGREY, BUT_NORMAL) ;
  1331. X  
  1332. X!   make_message(W_MAIN, BLACK_PLAYS) ;
  1333. X!   make_message(W_MAIN, WHITE_PLAYS) ;
  1334. X!   make_message(W_MAIN, PANEL_MES) ;
  1335. X!   make_message(W_MAIN, EVAL_MES) ;
  1336. X!   make_message(W_MAIN, SCORE_MES) ;
  1337. X!   make_message(W_MAIN, TURN_MES) ;
  1338. X  }
  1339. X  
  1340. X  
  1341. X***************
  1342. X*** 224,237 ****
  1343. X  
  1344. X    n = (int) mtype ;
  1345. X    color = (iscolor[(int) cur_dpyno]) ? C_BEIGE : C_WHITE ;
  1346. X!   color_area(items[n].x, items[n].y,
  1347. X               get_strwidth(NFONT, items[n].text), nfont_height + 5, color) ;
  1348. X!   draw_text(items[n].x, items[n].y + nfont_height, NFONT, C_BLACK, str) ;
  1349. X    STRCPY(items[n].text, str) ;
  1350. X  }
  1351. X  
  1352. X  
  1353. X  void
  1354. X  remove_textfield()
  1355. X  {
  1356. X    int x1, y1 ;
  1357. X--- 315,353 ----
  1358. X  
  1359. X    n = (int) mtype ;
  1360. X    color = (iscolor[(int) cur_dpyno]) ? C_BEIGE : C_WHITE ;
  1361. X!   color_area(W_MAIN, items[n].x, items[n].y,
  1362. X               get_strwidth(NFONT, items[n].text), nfont_height + 5, color) ;
  1363. X!   draw_text(W_MAIN, items[n].x, items[n].y + nfont_height,
  1364. X!             NFONT, C_BLACK, str) ;
  1365. X    STRCPY(items[n].text, str) ;
  1366. X  }
  1367. X  
  1368. X  
  1369. X  void
  1370. X+ paint_prop_sheet()
  1371. X+ {
  1372. X+   int color, d ;
  1373. X+ 
  1374. X+   d = (int) cur_dpyno ;
  1375. X+   color = (iscolor[d]) ? C_BEIGE : C_WHITE ;
  1376. X+   color_area(W_PROPS, 0, 0, PROPS_WIDTH, PROPS_HEIGHT, color) ;
  1377. X+ 
  1378. X+   color = (iscolor[d]) ? C_BEIGE : C_WHITE ;
  1379. X+   draw_choice(W_PROPS, COMP_CHOICE, color) ;
  1380. X+   draw_choice(W_PROPS, DIFF_CHOICE, color) ;
  1381. X+ 
  1382. X+   draw_cycle_item(W_PROPS, MAX_DEPTH, C_LGREY, CY_NORMAL) ;
  1383. X+ 
  1384. X+   draw_toggle(W_PROPS, OPT_ANIM, color) ;
  1385. X+   draw_toggle(W_PROPS, OPT_BEST, color) ;
  1386. X+   draw_toggle(W_PROPS, OPT_LAST, color) ;
  1387. X+   draw_toggle(W_PROPS, OPT_EVAL, color) ;
  1388. X+   draw_toggle(W_PROPS, OPT_NUM,  color) ;
  1389. X+   draw_toggle(W_PROPS, OPT_FLIP, color) ;
  1390. X+ }
  1391. X+ 
  1392. X+ 
  1393. X+ void
  1394. X  remove_textfield()
  1395. X  {
  1396. X    int x1, y1 ;
  1397. X***************
  1398. X*** 238,244 ****
  1399. X  
  1400. X    x1 = BBORDER + BWIDTH + (BGAP / 2) ;
  1401. X    y1 = BBORDER + BHEIGHT + (BGAP / 2) ;
  1402. X!   color_area(x1, y1, 4 * (BWIDTH + BGAP), BHEIGHT + BGAP,
  1403. X               (iscolor[(int) cur_dpyno]) ? C_BEIGE : C_WHITE) ;
  1404. X    tinput = 0 ;
  1405. X    items[(int) CANCEL_BUT].x = -1 ;
  1406. X--- 354,360 ----
  1407. X  
  1408. X    x1 = BBORDER + BWIDTH + (BGAP / 2) ;
  1409. X    y1 = BBORDER + BHEIGHT + (BGAP / 2) ;
  1410. X!   color_area(W_MAIN, x1, y1, 4 * (BWIDTH + BGAP), BHEIGHT + BGAP,
  1411. X               (iscolor[(int) cur_dpyno]) ? C_BEIGE : C_WHITE) ;
  1412. X    tinput = 0 ;
  1413. X    items[(int) CANCEL_BUT].x = -1 ;
  1414. X***************
  1415. X*** 247,267 ****
  1416. X  
  1417. X  
  1418. X  void
  1419. X! set_cycle(mtype, str)
  1420. X! enum panel_type mtype ;
  1421. X  char *str ;
  1422. X  {
  1423. X-   int n, width, x ;
  1424. X- 
  1425. X-   n = (int) mtype ;
  1426. X    color = (iscolor[(int) cur_dpyno]) ? C_BEIGE : C_WHITE ;
  1427. X  
  1428. X!   width = (3 * BWIDTH) + (2 * BGAP) -
  1429. X!            get_strwidth(BFONT, items[n].text) - CWIDTH ;
  1430. X!   x = items[n].x + get_strwidth(BFONT, items[n].text) ;
  1431. X!   color_area(x, items[n].y, width, items[n].height, color) ;
  1432. X! 
  1433. X!   width = get_strwidth(NFONT, str) ;
  1434. X!   x = items[n].x + (3 * BWIDTH) + (2 * BGAP) - CWIDTH - width ;
  1435. X!   draw_text(x - 5, items[n].y + nfont_height, NFONT, C_BLACK, str) ;
  1436. X  }
  1437. X--- 363,379 ----
  1438. X  
  1439. X  
  1440. X  void
  1441. X! set_cycle(wtype, item, str)
  1442. X! enum win_type wtype ;
  1443. X! enum panel_type item ;
  1444. X  char *str ;
  1445. X  {
  1446. X    color = (iscolor[(int) cur_dpyno]) ? C_BEIGE : C_WHITE ;
  1447. X  
  1448. X!   color_area(wtype, items[(int) item].x, items[(int) item].y,
  1449. X!              items[(int) item].width, CHEIGHT, color) ;
  1450. X!   draw_text(wtype, items[(int) item].x, items[(int) item].y + nfont_height,
  1451. X!             NFONT, C_BLACK, str) ;
  1452. X!   STRCPY(items[(int) item].text, str) ;
  1453. X!   items[(int) item].width = get_strwidth(NFONT, str) ;
  1454. X  }
  1455. X
  1456. END_OF_FILE
  1457. if test 44866 -ne `wc -c <'patches03b'`; then
  1458.     echo shar: \"'patches03b'\" unpacked with wrong size!
  1459. fi
  1460. # end of 'patches03b'
  1461. fi
  1462. echo shar: End of archive 5 \(of 9\).
  1463. cp /dev/null ark5isdone
  1464. MISSING=""
  1465. for I in 1 2 3 4 5 6 7 8 9 ; do
  1466.     if test ! -f ark${I}isdone ; then
  1467.     MISSING="${MISSING} ${I}"
  1468.     fi
  1469. done
  1470. if test "${MISSING}" = "" ; then
  1471.     echo You have unpacked all 9 archives.
  1472.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1473. else
  1474.     echo You still need to unpack the following archives:
  1475.     echo "        " ${MISSING}
  1476. fi
  1477. ##  End of shell archive.
  1478. exit 0
  1479.